package com.seeyou.lake.viewmodel

import androidx.lifecycle.MutableLiveData
import com.seeyou.lake.base.myBaseViewModel
import com.seeyou.lake.bean.UserBean
import com.seeyou.lake.net.BaseResult
import com.seeyou.lake.util.SPUtils

class SplashViewModel:myBaseViewModel() {
    val userResponse by lazy { MutableLiveData<BaseResult<UserBean>>() }

    fun login(userId:String,email:String,userAvatar:String,displayNames: String){
        netWorkJob(
            successResult = {
                val data = mReo.loginByGoogle(userId, email, userAvatar, displayNames)
                if (data.isOk()){
                    SPUtils.getInstance().putObject(SPUtils.SP_USER, data.data)
                    userResponse.value = data
                }else{
                    toast(data.message)
                }
            }
        )
       /* SPUtils.getInstance().putObject(SPUtils.SP_USER, UserBean(userAvatar,email,userId,displayNames))
        userResponse.value = BaseResult(200,"",UserBean(userAvatar,email,userId,displayNames))*/
    }
}